#delimit;
set logtype text;
log using gelpi.out, replace; 
set more off;

/* input data from GelpiPOCReplication.zip previously housed on
http://people.duke.edu/~gelpi/data.htm.  This dataset includes the
variable measuring approval of President Bush that is not included in
the dataset on the JCR web-site, but does not include the
four-category measure of approval of a timetable for withdrawal from
Iraq (apptimetable). */  

use GelpiFeb2009;

/* show list of variables in GelpiFeb2009 */

list in 1;

/* show from basic frequenices of the main dependent variables in
GelpiFeb2009 */

tab iraqwin warsucc, column;
tab disapptimetable;

/* now merge data from the JCR web-site before any recoding has been
done to show that the merge produces datasets that are from the same
study. This dataset includes the four-category measure of approval of
a timetable for withdrawal from Iraq. */

merge 1:1 caseid using GelpiPOC;

/* show list of variables from the merged dataset */

list in 1;

tab apptimetable disapptimetable;

/* recode the 4-category timetable variable so that higher values
reflect the pro-war position (i.e. disapproval of a time table) */

gen disapptimetable4=3-apptimetable;

/* replicate Gelpi's Table 1 Iraq Success results */
/* results replicate exactly */
logit warsucc posevents negevents posbush negbush democrat
republican;
logit warsucc posevents negevents posbush negbush democrat
republican poseventxdem poseventxrep negeventxdem negeventxrep
posbushxdem posbushxrep negbushxdem negbushxrep;

/* produce my Table 1 */

tab iraqwin; tab disapptimetable4;

/* produce my Table 2 */

tab disapptimetable4 if posevents==0 & negevents==0 & rep==1;
tab disapptimetable4 if posevents==1 & rep==1;

tab disapptimetable4 if posbush==0 & negbush==0 & rep==1;
tab disapptimetable4 if posbush==1 & rep==1;

/* produce my Table 3 */

gen ind=(dem==0 & rep==0);

ologit iraqwin posevents negevents posbush negbush if dem==1;
ologit iraqwin posevents negevents posbush negbush if ind==1;
ologit iraqwin posevents negevents posbush negbush if rep==1;

ologit disapptimetable4 posevents negevents posbush negbush if dem==1;
ologit disapptimetable4 posevents negevents posbush negbush if ind==1;
ologit disapptimetable4 posevents negevents posbush negbush if rep==1;

/* produce my Table 5 */

/* create simple scale that combines party id and approval */

/* first create a dichotmous measure of Bush approval */
gen bushapp=0 if bushapprove==3 | bushapprove==4;
replace bushapp=1 if bushapprove==1 | bushapprove==2;

/* then create a scale ranging from Democrats who disapprove of Bush
to Republicans who approve of Bush */
gen bushfav=0 if dem==1 & bushapp==0;
replace bushfav=1 if ind==1 & bushapp==0;
replace bushfav=2 if rep==1 & bushapp==0;
replace bushfav=3 if dem==1 & bushapp==1;
replace bushfav=4 if ind==1 & bushapp==1;
replace bushfav=5 if rep==1 & bushapp==1;

label variable bushfav "Simple Bush Scale";
label define bushfavv 0 "Dem/Dispp" 1 "Ind/Disapp" 2 "Rep/Disapp" 3
"Dem/Appr" 4 "Ind/Appr" 5 "Rep/Appr";
label values bushfav bushfavv;

/* finally, create the interactions between the scale and the
experimental treatments */
gen pecbf=posevents*bushfav; gen necbf=negevents*bushfav;
gen pccbf=posbush*bushfav; gen nccbf=negbush*bushfav;

logit surgebetter posevents negevents posbush negbush pecbf necbf
pccbf nccbf bushfav; 
ologit iraqwin posevents negevents posbush negbush pecbf necbf pccbf
nccbf bushfav; 
ologit disapptimetable4 posevents negevents posbush negbush pecbf
necbf pccbf nccbf bushfav; 

/* The following section provides commands use to produce the tables
in the on-line appendix */

/* Table A1 */

logit warsucc posevents negevents posbush negbush if dem==1;
logit warsucc posevents negevents posbush negbush if ind==1;
logit warsucc posevents negevents posbush negbush if rep==1;

logit disapptimetable posevents negevents posbush negbush if dem==1;
logit disapptimetable posevents negevents posbush negbush if ind==1;
logit disapptimetable posevents negevents posbush negbush if rep==1;

/* Table A21 */

ologit iraqwin i.posevents i.negevents i.posbush i.negbush
i.posevents#c.bushfav i.negevents#c.bushfav i.posbush#c.bushfav
i.negbush#c.bushfav c.bushfav; 

/* get significance of difference for negbush for ind and Rep who
approve */

margins r.negbush, at(posevents=0 negevents=0 posbush=0
bushfav=(4(1)5)) predict(outcome(0)) level(90); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0
bushfav=(4(1)5)) predict(outcome(1)) level(90); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0
bushfav=(4(1)5)) predict(outcome(2)) level(90); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0
bushfav=(4(1)5)) predict(outcome(3)) level(90); 

/* get results for negative events and cues */
margins, at(bushfav=(0(1)5) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(0));
matrix a=r(b);
matrix c1=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(1));
matrix a=r(b);
matrix c2=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(2));
matrix a=r(b);
matrix c3=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(3));
matrix a=r(b);
matrix c4=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
matrix bushfavi=(c1, c2, c3, c4);

/* Matrix provides predicted probabilities for the four response
choices for no treatment, negative event, and negative cue for
Democrats who disapprove of Bush, Independents who disapprove of Bush,
and so forth through Republicans who approve of Bush */

matrix list bushfavi;
matrix drop c1 c2 c3 c4 bushfavi;

/* get results for positive events and cues */
margins, at(bushfav=(0(1)5) posbush=(0(1)1) posevents=(0(1)1) 
negevents=0 negbush=0) predict(outcome(0));
matrix a=r(b);
matrix c1=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) posbush=(0(1)1) posevents=(0(1)1) 
negevents=0 negbush=0) predict(outcome(1));
matrix a=r(b);
matrix c2=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) posbush=(0(1)1) posevents=(0(1)1) 
negevents=0 negbush=0) predict(outcome(2));
matrix a=r(b);
matrix c3=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) posbush=(0(1)1) posevents=(0(1)1) 
negevents=0 negbush=0) predict(outcome(3));
matrix a=r(b);
matrix c4=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
matrix bushfavi=(c1, c2, c3, c4);

/* Matrix provides predicted probabilities for the four response
choices for no treatment, positive event, and positive cue for
Democrats who disapprove of Bush, Independents who disapprove of Bush,
and so forth through Republicans who approve of Bush */

matrix list bushfavi;
matrix drop c1 c2 c3 c4 bushfavi;

/* Table A22 */

ologit disapptimetable4 i.posevents i.negevents i.posbush i.negbush
i.posevents#c.bushfav i.negevents#c.bushfav i.posbush#c.bushfav
i.negbush#c.bushfav c.bushfav; 

/* get significance of difference for negbush for ind and Rep who
approve */

margins r.negbush, at(posevents=0 negevents=0 posbush=0
bushfav=(4(1)5)) predict(outcome(0)) level(90); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0
bushfav=(4(1)5)) predict(outcome(1)) level(90); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0
bushfav=(4(1)5)) predict(outcome(2)) level(90); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0
bushfav=(4(1)5)) predict(outcome(3)) level(90); 

/* get effects for negative events and cues */
margins, at(bushfav=(0(1)5) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(0));
matrix a=r(b);
matrix c1=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(1));
matrix a=r(b);
matrix c2=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(2));
matrix a=r(b);
matrix c3=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(3));
matrix a=r(b);
matrix c4=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
matrix bushfavd=(c1, c2, c3, c4);

/* Matrix provides predicted probabilities for the four response
choices for no treatment, negative event, and negative cue for
Democrats who disapprove of Bush, Independents who disapprove of Bush,
and so forth through Republicans who approve of Bush */

matrix list bushfavd;
matrix drop c1 c2 c3 c4 bushfavd;

/* get effects for positive events and cues */
margins, at(bushfav=(0(1)5) posbush=(0(1)1) posevents=(0(1)1) 
negevents=0 negbush=0) predict(outcome(0));
matrix a=r(b);
matrix c1=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) posbush=(0(1)1) posevents=(0(1)1) 
negevents=0 negbush=0) predict(outcome(1));
matrix a=r(b);
matrix c2=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) posbush=(0(1)1) posevents=(0(1)1) 
negevents=0 negbush=0) predict(outcome(2));
matrix a=r(b);
matrix c3=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
margins, at(bushfav=(0(1)5) posbush=(0(1)1) posevents=(0(1)1) 
negevents=0 negbush=0) predict(outcome(3));
matrix a=r(b);
matrix c4=a[1,1] \ a[1,13] \ a[1,7] \ a[1,2] \ a[1,14] \ a[1,8] \
a[1,3] \ a[1,15] \ a[1,9] \ a[1,4] \ a[1,16] \ a[1,10] \
a[1,5] \ a[1,17] \ a[1,11] \ a[1,6] \ a[1,18] \ a[1,12];
matrix drop a;
matrix bushfavd=(c1, c2, c3, c4);

/* Matrix provides predicted probabilities for the four response
choices for no treatment, positive event, and positive cue for
Democrats who disapprove of Bush, Independents who disapprove of Bush,
and so forth through Republicans who approve of Bush */

matrix list bushfavd;
matrix drop c1 c2 c3 c4 bushfavd;

/* Table A23 */

logit surgebetter posevents negevents posbush negbush if bushfav==0; 
logit surgebetter posevents negevents posbush negbush if bushfav==1; 
logit surgebetter posevents negevents posbush negbush if bushfav==2; 
logit surgebetter posevents negevents posbush negbush if bushfav==3; 
logit surgebetter posevents negevents posbush negbush if bushfav==4; 
logit surgebetter posevents negevents posbush negbush if bushfav==5; 

/* Table A24 */

ologit iraqwin posevents negevents posbush negbush if bushfav==0; 
ologit iraqwin posevents negevents posbush negbush if bushfav==1; 
ologit iraqwin posevents negevents posbush negbush if bushfav==2; 
ologit iraqwin posevents negevents posbush negbush if bushfav==3; 
ologit iraqwin posevents negevents posbush negbush if bushfav==4; 
ologit iraqwin posevents negevents posbush negbush if bushfav==5; 

/* Table A25 */

ologit disapptimetable4 posevents negevents posbush negbush if
bushfav==0;  
ologit disapptimetable4 posevents negevents posbush negbush if
bushfav==1;
ologit disapptimetable4 posevents negevents posbush negbush if
bushfav==2;
ologit disapptimetable4 posevents negevents posbush negbush if
bushfav==3;
ologit disapptimetable4 posevents negevents posbush negbush if
bushfav==4;
ologit disapptimetable4 posevents negevents posbush negbush if
bushfav==5;

/* Table A26 */

/* create the interactions between treatments and approval */

gen bushapp4=4-bushapprove;

label variable bushapp4 "Bush Approval";
label define bushapp4v 0 "Str Dispp" 1 "Some Disapp" 2 "Some Appr" 3
"Str Appr"; 
label values bushapp4 bushapp4v;

gen peba4=posevents*bushapp4; gen neba4=negevents*bushapp4;
gen pbba4=posbush*bushapp4; gen nbba4=negbush*bushapp4;

logit surgebetter posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 dem rep;
ologit iraqwin posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 dem rep;
ologit disapptimetable4 posevents negevents posbush negbush peba4 neba4
pbba4 nbba4 bushapp4 dem rep;

/* Table A27 */

ologit iraqwin i.posevents i.negevents i.posbush i.negbush
i.posevents#c.bushapp4 i.negevents#c.bushapp4 i.posbush#c.bushapp4
i.negbush#c.bushapp4 c.bushapp4 i.dem i.rep; 

/* get effects for negative events and cues for Dems */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=1 rep=0) predict(outcome(0));

matrix a=r(b);
matrix c1=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Dems */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=1 rep=0) predict(outcome(1));

matrix a=r(b);
matrix c2=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Dems */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=1 rep=0) predict(outcome(2));

matrix a=r(b);
matrix c3=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Dems */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=1 rep=0) predict(outcome(3));

matrix a=r(b);
matrix c4=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

matrix bushfavd=(c1, c2, c3, c4);

/* Matrix provides predicted probabilities for the four response
choices (columns) for no treatment, negative event, and negative cue
for Democrats who strongly disapprove of Bush, somewhat disapprove of
Bush, somewhat approve of Bush, and strongly approve of Bush */

matrix list bushfavd;
matrix drop c1 c2 c3 c4 bushfavd;

ologit disapptimetable4 i.posevents i.negevents i.posbush i.negbush
i.posevents#c.bushapp4 i.negevents#c.bushapp4 i.posbush#c.bushapp4
i.negbush#c.bushapp4 c.bushapp4 i.dem i.rep; 

/* get effects for negative events and cues for Dems */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=1 rep=0) predict(outcome(0));

matrix a=r(b);
matrix c1=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Dems */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=1 rep=0) predict(outcome(1));

matrix a=r(b);
matrix c2=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Dems */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=1 rep=0) predict(outcome(2));

matrix a=r(b);
matrix c3=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Dems */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=1 rep=0) predict(outcome(3));

matrix a=r(b);
matrix c4=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

matrix bushfavd=(c1, c2, c3, c4);

/* Matrix provides predicted probabilities for the four response
choices (columns) for no treatment, negative event, and negative cue
for Democrats who strongly disapprove of Bush, somewhat disapprove of
Bush, somewhat approve of Bush, and strongly approve of Bush */

matrix list bushfavd;
matrix drop c1 c2 c3 c4 bushfavd;

/* Table A28 */

ologit iraqwin i.posevents i.negevents i.posbush i.negbush
i.posevents#c.bushapp4 i.negevents#c.bushapp4 i.posbush#c.bushapp4
i.negbush#c.bushapp4 c.bushapp4 i.dem i.rep; 

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=0 rep=1) predict(outcome(0));

matrix a=r(b);
matrix c1=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=0 rep=1) predict(outcome(1));

matrix a=r(b);
matrix c2=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=0 rep=1) predict(outcome(2));

matrix a=r(b);
matrix c3=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=0 rep=1) predict(outcome(3));

matrix a=r(b);
matrix c4=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

matrix bushfavd=(c1, c2, c3, c4);

/* Matrix provides predicted probabilities for the four response
choices (columns) for no treatment, negative event, and negative cue for
Republicans who strongly disapprove of Bush, etc. */ 

matrix list bushfavd;
matrix drop c1 c2 c3 c4 bushfavd;

ologit disapptimetable4 i.posevents i.negevents i.posbush i.negbush
i.posevents#c.bushapp4 i.negevents#c.bushapp4 i.posbush#c.bushapp4
i.negbush#c.bushapp4 c.bushapp4 i.dem i.rep; 

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=0 rep=1) predict(outcome(0));

matrix a=r(b);
matrix c1=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=0 rep=1) predict(outcome(1));

matrix a=r(b);
matrix c2=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=0 rep=1) predict(outcome(2));

matrix a=r(b);
matrix c3=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0 dem=0 rep=1) predict(outcome(3));

matrix a=r(b);
matrix c4=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

matrix bushfavd=(c1, c2, c3, c4);

/* Matrix provides predicted probabilities for the four response
choices (columns) for no treatment, negative event, and negative cue
for Republicans who strongly disapprove of Bush, somewhat disapprove of
Bush, somewhat approve of Bush, and strongly approve of Bush */

matrix list bushfavd;
matrix drop c1 c2 c3 c4 bushfavd;

/* Table A29 */

ologit iraqwin posevents negevents posbush negbush peba4 neba4
posbushxrep nbba4 bushapp4 dem rep; 
ologit iraqwin posevents negevents posbush negbush peba4 neba4
posbushxrep posbushxdem nbba4 bushapp4 dem rep; 

ologit disapptimetable4 posevents negevents posbush negbush peba4
neba4 posbushxrep nbba4 bushapp4 dem rep; 
ologit disapptimetable4 posevents negevents posbush negbush peba4
neba4 posbushxrep posbushxdem nbba4 bushapp4 dem rep; 

/* Table A30 */

logit surgebetter posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if dem==1;
ologit iraqwin posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if dem==1;
ologit disapptimetable4 posevents negevents posbush negbush peba4 neba4
pbba4 nbba4 bushapp4 if dem==1;

logit surgebetter posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if ind==1;
ologit iraqwin posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if ind==1;
ologit disapptimetable4 posevents negevents posbush negbush peba4 neba4
pbba4 nbba4 bushapp4 if ind==1;

logit surgebetter posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if rep==1;
ologit iraqwin posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if rep==1;
ologit disapptimetable4 posevents negevents posbush negbush peba4 neba4
pbba4 nbba4 bushapp4 if rep==1;

/* Table A31 */

ologit iraqwin i.posevents i.negevents i.posbush i.negbush
i.posevents#c.bushapp4 i.negevents#c.bushapp4 i.posbush#c.bushapp4
i.negbush#c.bushapp4 c.bushapp4 if rep==1;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(0));

matrix a=r(b);
matrix c1=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(1));

matrix a=r(b);
matrix c2=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(2));

matrix a=r(b);
matrix c3=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(3));

matrix a=r(b);
matrix c4=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

matrix bushfavd=(c1, c2, c3, c4);

/* Matrix provides predicted probabilities for the four response
choices for no treatment, negative event, and negative cue for
Republicans who disapprove of Bush, Independents who disapprove of
Bush, and so forth through Republicans who strongly approve of Bush */

matrix list bushfavd;
matrix drop c1 c2 c3 c4 bushfavd;

ologit disapptimetable4 i.posevents i.negevents i.posbush i.negbush
i.posevents#c.bushapp4 i.negevents#c.bushapp4 i.posbush#c.bushapp4
i.negbush#c.bushapp4 c.bushapp4 if rep==1;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(0));

matrix a=r(b);
matrix c1=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(1));

matrix a=r(b);
matrix c2=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(2));

matrix a=r(b);
matrix c3=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

/* get effects for negative events and cues for Reps */
margins, at(bushapp4=(0(1)3) negbush=(0(1)1) negevents=(0(1)1) 
posevents=0 posbush=0) predict(outcome(3));

matrix a=r(b);
matrix c4=a[1,1] \ a[1,9] \ a[1,5] \ a[1,2] \ a[1,10] \ a[1,6] \
a[1,3] \ a[1,11] \ a[1,7] \ a[1,4] \ a[1,12] \ a[1,8] ;
matrix drop a;

matrix bushfavd=(c1, c2, c3, c4);

/* Matrix provides predicted probabilities for the four response
choices for no treatment, negative event, and negative cue for
Democrats who disapprove of Bush, Independents who disapprove of Bush,
and so forth through Republicans who approve of Bush */

matrix list bushfavd;
matrix drop c1 c2 c3 c4 bushfavd;

log close;

/*

/* now produce the interactions separately for each partisan group */

eststo: noisily logit warsucc posevents negevents posbush negbush if dem==1;
eststo: noisily logit warsucc posevents negevents posbush negbush if ind==1;
eststo: noisily logit warsucc posevents negevents posbush negbush if rep==1;

gen partyid=0 if dem==1;
replace partyid=1 if ind==1;
replace partyid=2 if rep==1;

gen disapptimetable4=3-apptimetable;

tab disapptimetable4 apptimetable;
tab disapptimetable apptimetable;
tab disapptimetable disapptimetable4;

logit disapptimetable posevents negevents posbush negbush democrat
republican; 
logit disapptimetable posevents negevents posbush negbush democrat 
republican poseventxdem poseventxrep negeventxdem negeventxrep
posbushxdem posbushxrep negbushxdem negbushxrep; 

/* now produce the interactions separately for each partisan group
(Table A.1) */

eststo: noisily logit disapptimetable posevents negevents posbush
negbush if dem==1; 
eststo: noisily logit disapptimetable posevents negevents posbush
negbush if ind==1; 
eststo: noisily logit disapptimetable posevents negevents posbush
negbush if rep==1; 

note: esttab using binrep.tex, abs z star(* 0.10 ** 0.02) staraux replace;

eststo clear;

ologit bushapp4 posevents negevents posbush negbush;

logit surgebetter posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if rep==1;
ologit iraqwin posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if rep==1;
ologit disapptimetable4 posevents negevents posbush negbush peba4 neba4
pbba4 nbba4 bushapp4 if rep==1;

logit surgebetter posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if ind==1;
ologit iraqwin posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if ind==1;
ologit disapptimetable4 posevents negevents posbush negbush peba4 neba4
pbba4 nbba4 bushapp4 if ind==1;

logit surgebetter posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if dem==1;
ologit iraqwin posevents negevents posbush negbush peba4 neba4 pbba4
nbba4 bushapp4 if dem==1;
ologit disapptimetable4 posevents negevents posbush negbush peba4 neba4
pbba4 nbba4 bushapp4 if dem==1;

ologit iraqwin i.posevents i.negevents i.posbush i.negbush
i.posevents#c.bushapp4 i.negevents#c.bushapp4 i.posbush#c.bushapp4
i.negbush#c.bushapp4 c.bushapp4 i.dem i.rep; 

margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(0)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(1)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(2)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(3)); 

margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(0)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(1)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(2)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(3)); 

margins, at(posevents=1 negevents=0 posbush=0 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=1 posbush=0
 negbush=0 dem=0 rep=1  bushapp4=(0(1)3)) predict(outcome(0));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span) xlabel(0(1)3);  
graph export iraqwin0ae.eps, as(eps) replace;
!epstopdf iraqwin0ae.eps;

margin r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) level(90) predict(outcome(3));
margin r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) level(90) predict(outcome(2));
margin r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) level(90) predict(outcome(1));
margin r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) level(90) predict(outcome(0));

margins, at(posevents=1 negevents=0 posbush=0 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=1 posbush=0
 negbush=0 dem=0 rep=1  bushapp4=(0(1)3)) predict(outcome(1));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span) xlabel(0(1)3);  
graph export iraqwin1ae.eps, as(eps) replace;
!epstopdf iraqwin1ae.eps;

margins, at(posevents=1 negevents=0 posbush=0 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=1 posbush=0
 negbush=0 dem=0 rep=1  bushapp4=(0(1)3)) predict(outcome(2));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span) xlabel(0(1)3);  
graph export iraqwin2ae.eps, as(eps) replace;
!epstopdf iraqwin2ae.eps;

margins, at(posevents=1 negevents=0 posbush=0 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=1 posbush=0
 negbush=0 dem=0 rep=1  bushapp4=(0(1)3)) predict(outcome(3));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span) xlabel(0(1)3);  
graph export iraqwin3ae.eps, as(eps) replace;
!epstopdf iraqwin3ae.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0
 negbush=1 dem=0 rep=1 bushapp4=(0(1)3)) predict(outcome(0));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)3);   
graph export iraqwin0ac.eps, as(eps) replace;
!epstopdf iraqwin0ac.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0
 negbush=1 dem=0 rep=1 bushapp4=(0(1)3)) predict(outcome(1));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)3);   
graph export iraqwin1ac.eps, as(eps) replace;
!epstopdf iraqwin1ac.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0
 negbush=1 dem=0 rep=1 bushapp4=(0(1)3)) predict(outcome(2));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)3);   
graph export iraqwin2ac.eps, as(eps) replace;
!epstopdf iraqwin2ac.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0
 negbush=1 dem=0 rep=1 bushapp4=(0(1)3)) predict(outcome(3));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)3);   
graph export iraqwin3ac.eps, as(eps) replace;
!epstopdf iraqwin3ac.eps;

ologit disapptimetable4 i.posevents i.negevents i.posbush i.negbush
i.posevents#c.bushapp4 i.negevents#c.bushapp4 i.posbush#c.bushapp4
i.negbush#c.bushapp4 c.bushapp4 i.dem i.rep; 

margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(0)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(1)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(2)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(3)); 

margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(0)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(1)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(2)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1
bushapp4=(0(1)3)) predict(outcome(3)); 

margins, at(posevents=1 negevents=0 posbush=0 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=1 posbush=0
 negbush=0 dem=0 rep=1  bushapp4=(0(1)3)) predict(outcome(0));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span) xlabel(0(1)3);  
graph export disapptime40ae.eps, as(eps) replace;
!epstopdf disapptime40ae.eps;

margins, at(posevents=1 negevents=0 posbush=0 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=1 posbush=0
 negbush=0 dem=0 rep=1  bushapp4=(0(1)3)) predict(outcome(1));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span) xlabel(0(1)3);  
graph export disapptime41ae.eps, as(eps) replace;
!epstopdf disapptime41ae.eps;

margins, at(posevents=1 negevents=0 posbush=0 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=1 posbush=0
 negbush=0 dem=0 rep=1  bushapp4=(0(1)3)) predict(outcome(2));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span) xlabel(0(1)3);  
graph export disapptime42ae.eps, as(eps) replace;
!epstopdf disapptime42ae.eps;

margins, at(posevents=1 negevents=0 posbush=0 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=1 posbush=0
 negbush=0 dem=0 rep=1  bushapp4=(0(1)3)) predict(outcome(3));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span) xlabel(0(1)3);  
graph export disapptime43ae.eps, as(eps) replace;
!epstopdf disapptime43ae.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0
 negbush=1 dem=0 rep=1 bushapp4=(0(1)3)) predict(outcome(0));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)3);   
graph export disapptime40ac.eps, as(eps) replace;
!epstopdf disapptime40ac.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0
 negbush=1 dem=0 rep=1 bushapp4=(0(1)3)) predict(outcome(1));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)3);   
graph export disapptime41ac.eps, as(eps) replace;
!epstopdf disapptime41ac.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0
 negbush=1 dem=0 rep=1 bushapp4=(0(1)3)) predict(outcome(2));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)3);
graph export disapptime42ac.eps, as(eps) replace;
!epstopdf disapptime42ac.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0 dem=0 rep=1
 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0 negbush=0
 dem=0 rep=1 bushapp4=(0(1)3)) at(posevents=0 negevents=0 posbush=0
 negbush=1 dem=0 rep=1 bushapp4=(0(1)3)) predict(outcome(3));
marginsplot, xdimension(bushapp4) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)3);
graph export disapptime43ac.eps, as(eps) replace;
!epstopdf disapptime43ac.eps;

gen cred=bushapp4/3+partyid/2;

gen pec=posevents*cred; gen nec=negevents*cred;
gen pcc=posbush*cred; gen ncc=negbush*cred;

logit surgebetter posevents negevents posbush negbush pec nec pcc ncc
cred;
ologit iraqwin posevents negevents posbush negbush pec nec pcc ncc
cred;
ologit disapptimetable4 posevents negevents posbush negbush pec nec pcc
ncc cred;

/* run a 'mixed' model that uses party id to evaluate events and the
credibility measure for cues */

logit surgebetter posevents negevents posbush negbush poseventxdem
poseventxrep negeventxdem negeventxrep pcc ncc dem rep cred;
ologit iraqwin posevents negevents posbush negbush poseventxdem
poseventxrep negeventxdem negeventxrep pcc ncc dem rep cred;
ologit disapptimetable4 posevents negevents posbush negbush
poseventxdem poseventxrep negeventxdem negeventxrep pcc ncc dem rep
cred; 

/* though, also run a mixed model where credibility uses only approval
so that party id only influences effect of events */

gen pcapp=posbush*bushapp4; gen ncapp=negbush*bushapp4;

logit surgebetter posevents negevents posbush negbush poseventxdem
poseventxrep negeventxdem negeventxrep pcapp ncapp dem rep bushapp4;
ologit iraqwin posevents negevents posbush negbush poseventxdem
poseventxrep negeventxdem negeventxrep pcapp ncapp dem rep bushapp4;
ologit disapptimetable4 posevents negevents posbush negbush
poseventxdem poseventxrep negeventxdem negeventxrep pcapp ncapp dem rep
bushapp4; 

/* use full range of approval data */

gen cred12=0 if bushapprove==4 & dem==1;
replace cred12=1 if bushapprove==4 & ind==1;
replace cred12=2 if bushapprove==4 & rep==1;
replace cred12=3 if bushapprove==3 & dem==1;
replace cred12=4 if bushapprove==3 & ind==1;
replace cred12=5 if bushapprove==3 & rep==1;
replace cred12=6 if bushapprove==2 & dem==1;
replace cred12=7 if bushapprove==2 & ind==1;
replace cred12=8 if bushapprove==2 & rep==1;
replace cred12=9 if bushapprove==1 & dem==1;
replace cred12=10 if bushapprove==1 & ind==1;
replace cred12=11 if bushapprove==1 & rep==1;

gen pec12=posevents*cred12; gen nec12=negevents*cred12;
gen pcc12=posbush*cred12; gen ncc12=negbush*cred12;

logit surgebetter posevents negevents posbush negbush pec12 nec12 pcc12 ncc12
cred12;
ologit iraqwin posevents negevents posbush negbush pec12 nec12 pcc12 ncc12
cred12;
ologit disapptimetable4 posevents negevents posbush negbush pec12 nec12 pcc12
ncc12 cred12;

/* divide sample into importance of Iraq */

logit surgebetter posevents negevents posbush negbush pec nec pcc ncc
cred if iraqissuerank>=1 & iraqissuerank<=3;
ologit iraqwin posevents negevents posbush negbush pec nec pcc ncc
cred if iraqissuerank>=1 & iraqissuerank<=3;
ologit disapptimetable4 posevents negevents posbush negbush pec nec pcc
ncc cred if iraqissuerank>=1 & iraqissuerank<=3;

logit surgebetter posevents negevents posbush negbush pec nec pcc ncc
cred if iraqissuerank>=4 & iraqissuerank<=7;
ologit iraqwin posevents negevents posbush negbush pec nec pcc ncc
cred if iraqissuerank>=4 & iraqissuerank<=7;
ologit disapptimetable4 posevents negevents posbush negbush pec nec pcc
ncc cred if iraqissuerank>=4 & iraqissuerank<=7;

logit surgebetter posevents negevents posbush negbush pec12 nec12 pcc12 ncc12
cred12 if iraqissuerank>=1 & iraqissuerank<=3;
ologit iraqwin posevents negevents posbush negbush pec12 nec12 pcc12 ncc12
cred12 if iraqissuerank>=1 & iraqissuerank<=3;
ologit disapptimetable4 posevents negevents posbush negbush pec12 nec12 pcc12
ncc12 cred12 if iraqissuerank>=1 & iraqissuerank<=3;

logit surgebetter posevents negevents posbush negbush pec12 nec12 pcc12 ncc12
cred12 if iraqissuerank>=4 & iraqissuerank<=7;
ologit iraqwin posevents negevents posbush negbush pec12 nec12 pcc12 ncc12
cred12 if iraqissuerank>=4 & iraqissuerank<=7;
ologit disapptimetable4 posevents negevents posbush negbush pec12 nec12 pcc12
ncc12 cred12 if iraqissuerank>=4 & iraqissuerank<=7;

/* divide sample into seriousness of reading article */

logit surgebetter posevents negevents posbush negbush pec nec pcc ncc
cred if tooktreatment==1;
ologit iraqwin posevents negevents posbush negbush pec nec pcc ncc
cred if tooktreatment==1;
ologit disapptimetable4 posevents negevents posbush negbush pec nec pcc
ncc cred if tooktreatment==1;

logit surgebetter posevents negevents posbush negbush pec nec pcc ncc
cred if tooktreatment==2;
ologit iraqwin posevents negevents posbush negbush pec nec pcc ncc
cred if  tooktreatment==2;
ologit disapptimetable4 posevents negevents posbush negbush pec nec pcc
ncc cred if tooktreatment==2;

logit surgebetter posevents negevents posbush negbush pec12 nec12 pcc12 ncc12
cred12 if tooktreatment==1;
ologit iraqwin posevents negevents posbush negbush pec12 nec12 pcc12 ncc12
cred12 if tooktreatment==1;
ologit disapptimetable4 posevents negevents posbush negbush pec12 nec12 pcc12
ncc12 cred12 if tooktreatment==1;

logit surgebetter posevents negevents posbush negbush pec12 nec12 pcc12 ncc12
cred12 if tooktreatment==2;
ologit iraqwin posevents negevents posbush negbush pec12 nec12 pcc12 ncc12
cred12 if tooktreatment==2;
ologit disapptimetable4 posevents negevents posbush negbush pec12 nec12 pcc12
ncc12 cred12 if tooktreatment==2;

note: esttab using bushfavd.tex, se star(* 0.10 ** 0.02) replace;

eststo clear;

note: esttab using bushfav.tex, se star(* 0.10 ** 0.02) scalars(chi2) replace;

eststo clear;

/* margins, at(posevents=1 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=1 posbush=0 negbush=0
 bushfav=(0(1)5)) predict(outcome(0));
marginsplot, xdimension(bushfav) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span) xlabel(0(1)5);  
graph export iraqwin0e.eps, as(eps) replace;
!epstopdf iraqwin0e.eps;

margins, at(posevents=1 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=1 posbush=0 negbush=0
 bushfav=(0(1)5)) predict(outcome(1));
marginsplot, xdimension(bushfav) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)5);
graph export iraqwin1e.eps, as(eps) replace;
!epstopdf iraqwin1e.eps;

margins, at(posevents=1 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=1 posbush=0 negbush=0
 bushfav=(0(1)5)) predict(outcome(2));
marginsplot, xdimension(bushfav) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)5);
graph export iraqwin2e.eps, as(eps) replace;
!epstopdf iraqwin2e.eps;

margins, at(posevents=1 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=1 posbush=0 negbush=0
 bushfav=(0(1)5)) predict(outcome(3));
marginsplot, xdimension(bushfav) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)5);
graph export iraqwin3e.eps, as(eps) replace;
!epstopdf iraqwin3e.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=1
 bushfav=(0(1)5)) predict(outcome(0));
marginsplot, xdimension(bushfav) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)5);
graph export iraqwin0c.eps, as(eps) replace;
!epstopdf iraqwin0c.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=1
 bushfav=(0(1)5)) predict(outcome(1));
marginsplot, xdimension(bushfav) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)5);
graph export iraqwin1c.eps, as(eps) replace;
!epstopdf iraqwin1c.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=1
 bushfav=(0(1)5)) predict(outcome(2));
marginsplot, xdimension(bushfav) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)5);
graph export iraqwin2c.eps, as(eps) replace;
!epstopdf iraqwin2c.eps;

margins, at(posevents=0 negevents=0 posbush=1 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=0
 bushfav=(0(1)5)) at(posevents=0 negevents=0 posbush=0 negbush=1
 bushfav=(0(1)5)) predict(outcome(3));
marginsplot, xdimension(bushfav) title(Effect of Events)
ytitle(Probability of Success) plot1opts(lpattern(solid))
plot2opts(lpattern(dot) msymbol(Dh)) plot3opts(lpattern(dash) msymbol(Oh))
legend(order(1 "Positive" 2 "None" 3 "Negative") row(1) span)
 xlabel(0(1)5);
graph export iraqwin3c.eps, as(eps) replace;
!epstopdf iraqwin3c.eps; */

/* use interaction with bushfav3--8-pt scale reflecting cross-pressures */

gen bushfav3=0 if bushapp4==0 & partyid==0;
replace bushfav3=1 if bushapp4==0 & partyid==1;
replace bushfav3=1 if bushapp4==1 & partyid==0;
replace bushfav3=2 if bushapp4==1 & partyid==1;
replace bushfav3=3 if bushapp4==0 & partyid==2;
replace bushfav3=3 if bushapp4==2 & partyid==0;
replace bushfav3=4 if bushapp4==3 & partyid==0;
replace bushfav3=4 if bushapp4==1 & partyid==2;
replace bushfav3=5 if bushapp4==2 & partyid==1;
replace bushfav3=6 if bushapp4==2 & partyid==2;
replace bushfav3=6 if bushapp4==3 & partyid==1;
replace bushfav3=7 if bushapp4==3 & partyid==2;

gen pecbf3=posevents*bushfav3; gen necbf3=negevents*bushfav3;
gen pccbf3=posbush*bushfav3; gen nccbf3=negbush*bushfav3;

logit surgebetter posevents negevents posbush negbush pecbf3 necbf3
pccbf3 nccbf3 bushfav3;
eststo: noisily ologit iraqwin posevents negevents posbush negbush
pecbf3 necbf3 pccbf3 nccbf3 bushfav3;
eststo: noisily ologit disapptimetable4 posevents negevents posbush
negbush pecbf3 necbf3 pccbf3 nccbf3 bushfav3;

note: esttab using bushfav3.tex, se star(* 0.10 ** 0.02) replace;

eststo clear;

/* Generate ordered logit results treating approval as nominal */

ologit iraqwin i.posevents i.negevents i.posbush i.negbush
i.dem i.rep if bushapp4==0; 

margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(0)); 
matrix a=r(b);
matrix o0=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(1)); 
matrix a=r(b);
matrix o1=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(2)); 
matrix a=r(b);
matrix o2=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(3)); 
matrix a=r(b);
matrix o3=a[1,1] \ a[1,3] \ a[1,2];
matrix app0r=(o0 , o1 , o2 , o3);
matrix drop a o0 o1 o2 o3;
matrix list app0r;

margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(3)); 

margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(3)); 

ologit iraqwin i.posevents i.negevents i.posbush i.negbush
i.dem i.rep if bushapp4==1; 

margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(0)); 
matrix a=r(b);
matrix o0=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(1)); 
matrix a=r(b);
matrix o1=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(2)); 
matrix a=r(b);
matrix o2=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(3)); 
matrix a=r(b);
matrix o3=a[1,1] \ a[1,3] \ a[1,2];
matrix app1r=(o0 , o1 , o2 , o3);
matrix drop a o0 o1 o2 o3;
matrix list app1r;

margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(3)); 

margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(3)); 

ologit iraqwin i.posevents i.negevents i.posbush i.negbush
i.dem i.rep if bushapp4==2; 

margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(0)); 
matrix a=r(b);
matrix o0=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(1)); 
matrix a=r(b);
matrix o1=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(2)); 
matrix a=r(b);
matrix o2=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(3)); 
matrix a=r(b);
matrix o3=a[1,1] \ a[1,3] \ a[1,2];
matrix app2r=(o0 , o1 , o2 , o3);
matrix drop a o0 o1 o2 o3;
matrix list app2r;

margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(3)); 

margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(3)); 

ologit iraqwin i.posevents i.negevents i.posbush i.negbush
i.dem i.rep if bushapp4==3; 

margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(0)); 
matrix a=r(b);
matrix o0=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(1)); 
matrix a=r(b);
matrix o1=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(2)); 
matrix a=r(b);
matrix o2=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(3)); 
matrix a=r(b);
matrix o3=a[1,1] \ a[1,3] \ a[1,2];
matrix app3r=(o0 , o1 , o2 , o3);
matrix drop a o0 o1 o2 o3;
matrix list app3r;

margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(3)); 

margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(3)); 

matrix iwinr= app0r \ app1r \ app2r \ app3r;
matrix list iwinr;
matrix drop app0r app1r app2r app3r;

ologit disapptimetable4 i.posevents i.negevents i.posbush i.negbush
i.dem i.rep if bushapp4==0; 

margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(0)); 
matrix a=r(b);
matrix o0=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(1)); 
matrix a=r(b);
matrix o1=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(2)); 
matrix a=r(b);
matrix o2=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(3)); 
matrix a=r(b);
matrix o3=a[1,1] \ a[1,3] \ a[1,2];
matrix app0r=(o0 , o1 , o2 , o3);
matrix drop a o0 o1 o2 o3;
matrix list app0r;

margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(3)); 

margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(3)); 

ologit disapptimetable4 i.posevents i.negevents i.posbush i.negbush
i.dem i.rep if bushapp4==1; 

margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(0)); 
matrix a=r(b);
matrix o0=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(1)); 
matrix a=r(b);
matrix o1=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(2)); 
matrix a=r(b);
matrix o2=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(3)); 
matrix a=r(b);
matrix o3=a[1,1] \ a[1,3] \ a[1,2];
matrix app1r=(o0 , o1 , o2 , o3);
matrix drop a o0 o1 o2 o3;
matrix list app1r;

margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(3)); 

margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(3)); 

ologit disapptimetable4 i.posevents i.negevents i.posbush i.negbush
i.dem i.rep if bushapp4==2; 

margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(0)); 
matrix a=r(b);
matrix o0=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(1)); 
matrix a=r(b);
matrix o1=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(2)); 
matrix a=r(b);
matrix o2=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(3)); 
matrix a=r(b);
matrix o3=a[1,1] \ a[1,3] \ a[1,2];
matrix app2r=(o0 , o1 , o2 , o3);
matrix drop a o0 o1 o2 o3;
matrix list app2r;

margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(3)); 

margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(3)); 

ologit disapptimetable4 i.posevents i.negevents i.posbush i.negbush
i.dem i.rep if bushapp4==3; 

margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(0)); 
matrix a=r(b);
matrix o0=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(1)); 
matrix a=r(b);
matrix o1=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(2)); 
matrix a=r(b);
matrix o2=a[1,1] \ a[1,3] \ a[1,2];
matrix drop a;
margins, at(posevents=0 negevents=(0(1)1) posbush=0 negbush=(0(1)1)
 dem=0 rep=1)  predict(outcome(3)); 
matrix a=r(b);
matrix o3=a[1,1] \ a[1,3] \ a[1,2];
matrix app3r=(o0 , o1 , o2 , o3);
matrix drop a o0 o1 o2 o3;
matrix list app3r;

matrix itimer= app0r \ app1r \ app2r \ app3r;
matrix list itimer;
matrix drop app0r app1r app2r app3r;

margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negevents, at(posevents=0 posbush=0 negbush=0 dem=0 rep=1)
predict(outcome(3)); 

margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(0)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(1)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(2)); 
margins r.negbush, at(posevents=0 negevents=0 posbush=0 dem=0 rep=1)
predict(outcome(3)); 

eststo: noisily ologit disapptimetable4 posevents negevents posbush
negbush peba4 neba4 posbushxrep nbba4 bushapp4 dem rep;
eststo: noisily ologit disapptimetable4 posevents negevents posbush
negbush peba4 neba4 posbushxrep posbushxdem nbba4 bushapp4 dem rep; 

note: esttab using mixedmod.tex, se star(* 0.10 ** 0.02) replace;

/* No need for a final model where negbush applies to everyone.  Would
need to see significant main effect and no interaction effect.  As it
turns out, no main effect, but significant interaction effect as
likelihood of credibility increases */

log close;

*/
